import "nprogress/nprogress.css";
import { start, done, configure } from "nprogress";
import NotFound from "../views/NotFound.vue";

configure({
    trickleSpeed: 20,
    showSpinner: false,
});

function getComponent(importComp) {
    return async ()=>{
        start();
        const comp = await importComp();
        done();
        return comp;
    }
}

export default [
    {
        name: "home",
        path: "/",
        component: getComponent(() => import("../views/Home.vue")),
        meta: {
            title: "首页"
        }
    },
    {
        name: "blog",
        path: "/blog",
        component: getComponent(() => import("../views/Blog.vue")),
        meta: {
            title: "文章"
        }
    },
    {
        name: "blogCategory",
        path: "/blog/cate/:categoryId",
        component: getComponent(() => import("../views/Blog.vue")),
        mate:{
            title: "文章"
        }
    },
    {
        name: "blogDetail",
        path: "/blog/detail/:blogId",
        component: getComponent(() => import("../views/Detail.vue")),
        meta: {
            title: "文章详情"
        }
    },
    {
        name: "about",
        path: "/about",
        component: getComponent(() => import("../views/About.vue")),
        meta: {
            title: "关于我"
        }
    },
    {
        name: "project",
        path: "/project",
        component: getComponent(() => import("../views/Project.vue")),
        meta: {
            title: "项目&效果"
        }
    },
    {
        name: "message",
        path: "/message",
        component: getComponent(() => import("../views/Message.vue")),
        meta: {
            title: "留言板"
        }
    },
    {
        name: "notFound",
        path: "*",
        component: NotFound,
        meta:{
            title: "页面找不到"
        }
    }
];